(function(window) {
	// http://dev.umeng.com/analytics/android-doc/integration#2_3
	// http://bbs.umeng.com/thread-6402-1-1.html
    //
    // 因数据统计偏低，不再用了
    //
	function MyUmeng() {
        // Mate-Android
		this.androidKey = '59b2a6196e27a43b100002fe';

        // Test-Android(内部测试使用，不发布)
        // this.androidKey = '59d7873099f0c7243200001b';

        // Mate-iOS
		this.iosKey = '59b418924544cb03d6001fe6';

		this.isAndroid = isAndroid();
		this._init();
	}
	MyUmeng.prototype = {
		_init: function() {
			_wlog('init...');
			var key = this.isAndroid ? this.androidKey : this.iosKey;
			this._mod().init({
				appKey: key,
				channelId: 'apicloud',
				debug: false,
			}, function(ret, err) {
				_wlog('init result: ' + toJson(ret || err));
			});
		},

		// 下面 onPause 和 onResume，仅android实现了
		onPause: function() {
			this.isAndroid && this._mod().onPause();
		},
		onResume: function() {
			this.isAndroid && this._mod().onResume();
		},

		_mod: function() {
			return api.require("myUmeng");
		}
	}

	function _log(t) {
		tlog('[myU](' + api.systemType + ') ' + t);
	}
	function _wlog(t) {
		wlog('[myU](' + api.systemType + ') ' + t);
	}
	function _elog(t) {
		elog('[myU](' + api.systemType + ') ' + t);
	}

	window.MyUmeng = MyUmeng;
})(window);
